<script lang="ts">
import Vue from 'vue'
import store, {systemModule, userModule} from "@/plugins/store";
import ThreeAuthResultVO from "@/model/ThreeAuthResultVO";
import ResultVO from "@/model/ResultVO";
import TokenUtil from "@/utils/TokenUtil";
import TalkAPI from "@/api/TalkAPI";
import ThreeAuthType from "@/const/ThreeAuthType";

export default Vue.extend({
  mpType: 'app',
  onLaunch() {
    systemModule.getSystemInfo()
    //页面启动，启动函数
  },
  //@ts-ignore
  onShow(params) {
    console.log(params)
    if (params.referrerInfo) {
      const info = params.referrerInfo
      //这里可以返回回来的appId
      // appModule.threeProviderAppId = info.appId
      if (info.extraData) {
        const extraData: ResultVO<ThreeAuthResultVO> = info.extraData
        if (extraData.success) {
          const authData: ThreeAuthResultVO = extraData.data
          if (authData.authType === ThreeAuthType.user) {
            userModule.setUser(authData.user)
            TokenUtil.set(authData.tokenCode)
          } else {
            console.log(userModule.phoneNum)
            userModule.phoneNum = authData.phoneNum
            console.log(userModule.phoneNum)
          }
        }
        //传入token获取用户综合信息
        // appModule.threeSecretKey = extraData.tokenCode
        // appModule.threeUserId = extraData.userId
      }
    }
  }
})
</script>
<style lang="scss">
@import "./styles/iconfont/index.css";
@import "./styles/color/index.css";
@import "./styles/index.scss";
//@import "./components/element/theme-chalk/src/index.scss";
//@import './components/qing/styles/index';
</style>
